import service from '@/utils/request'

// 获取客户列表
export const getClientListApi = (dataForm: any) => {
	return service.get('/customerInfo/page', {params: dataForm})
}

// 获取客户列表（下拉选项）
export const selectCustomerList = (dataForm: any) => {
	return service.get('/customerInfo/selectCustomerList', {params: dataForm})
}

// 获取客户信息
export const useClientApi = (id: Number) => {
	return service.get('/customerInfo/' + id)
}

// 新增/修改客户信息
export const useClientSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return service.post('/customerInfo/update', dataForm)
	} else {
		return service.post('/customerInfo/save', dataForm)
	}
}

export const useDictDataApi = (id: Number) => {
	return service.get('/sys/dict/data/' + id)
}

export const useDictDataSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return service.put('/sys/dict/data', dataForm)
	} else {
		return service.post('/sys/dict/data', dataForm)
	}
}
// 下載出货量
export const downloadShipment = (dataForm: any) => {
	return service.post('/customerInfo/downloadShipments', dataForm,
	{
		responseType: 'blob'
	})
}
